home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 226-250 / disk_237 / speed / speed.s < prev   
Text File  |  1992-05-06  |  15KB  |  858 lines

  1.     opt    w-,l-,d-        * Warnings Off, Linkable code, Debugging Off
  2.  
  3.   ***************************************************************
  4. * *                                                           * *
  5. * *                                                           * *
  6. * *            Speed 2.00, by Jez San            * *
  7. * *         (c)1989 Argonaut Software Ltd.            * *
  8. * *                                                           * *
  9. * *        Mill Hill, London...   ENGLAND            * *
  10. * *                                                           * *
  11. * *    FrillFree Shareware Software For Amiga Computers        * *
  12. * *                                                           * *
  13. * *                                                          * *
  14.   ***************************************************************
  15.  
  16.  
  17. *
  18. * Blatant ad:
  19. *
  20. * This program was assembled using ArgAsm, a new assembler coming soon from
  21. * Argonaut Software.  It is compatible with its contemporaries, but at
  22. * least 10 times faster than the fastest competition.  We're talking up
  23. * to 1 million lines per minute on a standard Amiga... typically 250,000.
  24. * ArgAsm v1 assembles this file in 0.22 secs, Devpac v2 in 2.50 secs,
  25. * and Cape v2 in 4.60 secs all figures tested on a standard A2000 with
  26. * no turbo cards fitted!   ArgAsm is The Fastest Assembler, Bar None!
  27. *
  28. * We ship ArgAsm v1.0 on September 1st.
  29. *
  30. * Orders are being taken right now for 60 pounds UK STERLING, ie:
  31. * US $85 including tax, postage etc.  Write with cheque or money
  32. * to Argonaut, 7 Millway, Mill Hill, London NW7 3QR, ENGLAND.
  33. * or tel: (01) 906 3744, international 011 +44 1 906 3744
  34. *
  35. * Foreign (US & Europe) distributors sought.
  36. *
  37.  
  38.     output    speed            * ArgAsm & Devpac allow filenames!
  39.  
  40. *
  41. * To save time having to use includes files, and for the benefit of
  42. * those programmers who dont have access to Commodore Includes :-
  43. *
  44.  
  45. _SysBase    equ    4
  46. _LVOOpenLibrary    equ    -552        * library offsets from _SysBase
  47. _LVOCloseLibrary    equ    -414
  48. _LVOGetMsg    equ    -372
  49. _LVOReplyMsg    equ    -378
  50. _LVOWaitPort    equ    -384
  51. _LVOFindPort    equ    -390
  52.  
  53. _LVOCloseWindow    equ    -72
  54. _LVOOpenWindow    equ    -204
  55.  
  56. _LVOInput    equ    -54
  57. _LVOOutput    equ    -60
  58. _LVOWrite    equ    -48
  59. _LVODateStamp    equ    -192
  60.  
  61. AttnFlags    equ    $00000128    * Word Off of Execbase
  62. TDNestCnt    equ    $00000127    * Byte
  63.  
  64. forbid    macro
  65.     move.l    4,a6
  66.     addq.b    #1,TDNestCnt(a6)
  67.     endm
  68.  
  69. permit    macro
  70.     move.l    4,a6
  71.     subq.b    #1,TDNestCnt(a6)
  72.     endm
  73.  
  74. * Open DOS library.
  75.  
  76.     bra.s    startup
  77.  
  78.     dc.b    12,10,"* THIS IS SHAREWARE !*",0
  79.  
  80. startup    move.l    _SysBase,a6    * Pointer to Exec Library
  81.     lea    thedos(pc),a1    * Point to title of DOS
  82.     moveq     #0,d0        * Version number
  83.     jsr    _LVOOpenLibrary(a6)
  84.     move.l    d0,_DosBase    * DOS library Pointer
  85.     beq    openerr        * Error, can't open library!
  86.  
  87. * Open Console for I/O.
  88.  
  89.     move.l    _DosBase,a6
  90.     jsr    _LVOInput(a6)
  91.     move.l    d0,ohandle
  92.  
  93.     jsr    _LVOOutput(a6)
  94.     move.l    d0,chandle
  95.  
  96.     bsr    p
  97.     dc.b    12,"SPEED 2.00 - Amiga Performance Analyser by Jez San (c)1989 Argonaut Software.",10,10
  98.     dc.b    "This tests two aspects of your Amiga system :-",10
  99.     dc.b    "a) The approximate clockspeed the processor is running at.",10
  100.     dc.b    "b) The approximate system performance in the form of a benchmark.",10
  101.     dc.b    10
  102.     dc.b    "Both figures a & b are important for different reasons eg: Despite",10
  103.     dc.b    "having a fast clockspeed, your machine may not run at its full",10
  104.     dc.b    "system performance, due to Waitstates, Cache's, Burstfetches etc",10
  105.     dc.b    "Hence the need for a good measure of both clockspeed AND realworld",10
  106.     dc.b    "performance when compared to a normally aspirated Amiga.",10
  107.     dc.b    10
  108.  
  109.     dc.b    0
  110.     even
  111.  
  112. *
  113. * First determine which processor we are running on, 68000, 68010, 68020 or 68030.
  114. *
  115.  
  116.     bsr    p
  117.     dc.b    "The Amiga EXEC reckons that a ",0
  118.     even
  119.  
  120.     move.l    4,a6
  121.     moveq    #0,d0
  122.     move.w    AttnFlags(a6),d0
  123.  
  124.     move.l    _DosBase,a6
  125.  
  126.     btst    #3,d0            * 68040?
  127.     beq.s    trynext0
  128.  
  129.     bsr    p
  130.     dc.b    "68040",0
  131.     even
  132.     move.l    #30*20,procrate        * Tick rate * Mhz (dead) <<-- GUESSWORK!
  133.     bra.s    definiteproccy
  134.  
  135. trynext0
  136.     btst    #2,d0            * 68030?
  137.     beq.s    trynext1
  138.  
  139.     bsr    p
  140.     dc.b    "68030",0
  141.     even
  142.     move.l    #37*20,procrate        * Tick rate * Mhz (approx)
  143.     bra.s    definiteproccy
  144.  
  145. trynext1
  146.     btst    #1,d0
  147.     beq.s    trynext2
  148.  
  149.     bsr    p            * 68020
  150.     dc.b    "68020",0
  151.     even
  152.     move.l    #53*14+17+3,procrate    * Tickrate * Mhz + frac
  153.     bra.s    definiteproccy
  154.  
  155.  
  156. trynext2
  157.     btst    #0,d0
  158.     beq.s    trynext3
  159.  
  160.     bsr    p            * 68010
  161.     dc.b    "68010",0
  162.     even
  163.     move.l    #242*7,procrate        * (at a guess!)
  164.     bra.s    definiteproccy
  165.  
  166. trynext3
  167.     bsr    p            * 68000
  168.     dc.b    "68000",0
  169.     even
  170.     move.l    #242*7+38,procrate    * Tickrate * Mhz + frac
  171.  
  172. definiteproccy
  173.     bsr    p
  174.     dc.b    " processor is installed in this system.",10,0
  175.     even
  176.  
  177. *
  178. * next, Determine clockspeed...
  179. *
  180.  
  181.     bsr    p
  182.     dc.b    "Analysing clockspeed... ",0
  183.     even
  184.  
  185.     bsr    gettimer
  186.     move.l    d0,-(sp)
  187.  
  188.     forbid
  189.     bsr    lotsadivs
  190.     permit
  191.  
  192.     bsr    gettimer
  193.     sub.l    (sp)+,d0
  194.  
  195.     move.l    d0,-(sp)
  196.  
  197.     bsr    p
  198.     dc.b    "Took ",0
  199.     even
  200.  
  201.     move.l    (sp),d0
  202.     bsr    printbin2dec
  203.  
  204.     bsr    p
  205.     dc.b    " ticks, which is ",0
  206.     even
  207.  
  208.     move.l    (sp)+,d6
  209.     move.l    procrate,d0
  210.     move.l    d0,d5
  211.     bsr    printfrac
  212.  
  213.     bsr    p
  214.     dc.b    " Mhz +-2% (fig A)",10,10,0
  215.     even
  216.  
  217.  
  218. *
  219. * Next, Determine system throughput.... which is a realworld comparitive figure
  220. * of Amiga to Amiga performance.   Ie: Tests processor speed, ram fetch speed,
  221. * and execution speed in an aggregate benchmark of integer performance that
  222. * real world programs should realise.
  223. *
  224.  
  225.     bsr    gettimer
  226.     move.l    d0,-(sp)
  227.  
  228.     bsr    p
  229.     dc.b    "Computing 10,000 SlightlyMoistSmallRocks in... ",0
  230.     even
  231.  
  232.     forbid
  233.     bsr    SlightlyMoistSmallRocks        * YAB
  234.     permit
  235.  
  236.     bsr    gettimer
  237.     sub.l    (sp)+,d0
  238.     move.l    d0,d6
  239.  
  240.     move.l    d6,-(sp)
  241.  
  242.     bsr    printbin2dec
  243.  
  244.     bsr    p
  245.     dc.b    " ticks.",10,10,0
  246.     even
  247.  
  248.     move.l    (sp),d6
  249.     move.l    #702,d0
  250.     move.l    d0,d5
  251.  
  252.     bsr    printfrac
  253.  
  254.     bsr    p
  255.     dc.b    " times (fig B) the speed of a normal Amiga at 7.159 Mhz +-2%.",10,0
  256.     even
  257.  
  258.     move.l    (sp)+,d6
  259.     move.l    #234,d0
  260.     move.l    d0,d5
  261.     bsr    printfrac
  262.  
  263.     bsr    p
  264.     dc.b    " times the speed of an A2620 at 14.318 Mhz +-2%.",10
  265.     dc.b    10
  266.     dc.b    "Rating against an A2620 : ",0
  267.     even
  268.  
  269. * Is it fast enough to be worth commenting about...?
  270.  
  271.     move.w    integer,d0
  272.     dbra    d0,notworth1
  273.     bsr    p
  274.     dc.b    "Yawn.",10,0
  275.     even
  276.  
  277.     bra    arnold
  278.  
  279. notworth1
  280.     dbra    d0,notworth2
  281.  
  282.     bsr    p
  283.     dc.b    "About the same.",10,0
  284.     even
  285.  
  286.     bra    arnold
  287.  
  288. notworth2
  289.     dbra    d0,notworth3
  290.  
  291.     bsr    p
  292.     dc.b    "Quite fast.",10,0
  293.     even
  294.  
  295.     bra    arnold
  296.  
  297. notworth3
  298.     dbra    d0,notworth4
  299.  
  300.     bsr    p
  301.     dc.b    "Pretty fast.",10,0
  302.     even
  303.  
  304.     bra    arnold
  305.  
  306. notworth4
  307.     dbra    d0,notworth5
  308.  
  309.     bsr    p
  310.     dc.b    "Quite Impressive.",10,0
  311.     even
  312.  
  313.     bra    arnold
  314.  
  315.  
  316. notworth5
  317.     dbra    d0,notworth6
  318.  
  319.     bsr    p
  320.     dc.b    "Mighty Impressive.",10,0
  321.     even
  322.  
  323.     bra    arnold
  324.  
  325. notworth6
  326.     dbra    d0,notworth7
  327.  
  328.     bsr    p
  329.     dc.b    "Like wow man!",10,0
  330.     even
  331.  
  332.     bra    arnold
  333.  
  334. notworth7
  335.     dbra    d0,notworth8
  336.  
  337.     bsr    p
  338.     dc.b    "This is my kinda machine!!",10,0
  339.     even
  340.  
  341.     bra    arnold
  342.  
  343. notworth8
  344.     bsr    p
  345.     dc.b    "Off the scale, this machine has some serious speed!",10,0
  346.     even
  347.  
  348.  
  349. * Terminator
  350. arnold
  351.  
  352. close2    move.l    _SysBase,a6
  353.     move.l    _DosBase,a1     * Close the DOS library
  354.     jsr    _LVOCloseLibrary(a6)
  355.  
  356. openerr    rts
  357.  
  358. closeerr
  359.     bsr    p
  360.     dc.b    "Hmmm, Error in Calculation (Zero time taken!).",10,0
  361.     even
  362.     bra.s    close2
  363.  
  364.  
  365. *
  366. * This entire loop takes up about 50000 * 5 * 62 = 15,500,000 cycles
  367. * ie: 0.78 seconds at 20 mhz on a 68030 system
  368. *
  369. * The use of registerised Divides is to reduce ramfetching to a minimum
  370. * and really give the processor something to think about, hence useful
  371. * for calculating raw clockspeed as opposed to system performance!
  372. *
  373.  
  374.  
  375. lotsadivs
  376.     move.w    #50000,d7        * Perform the loop 50000 times
  377.     move.l    #65535,d2        * Preload the parameters to ensure fair timings
  378.     move.l    #65535,d3
  379.  
  380. * This loop will be cached perfectly and shouldnt have much overhead
  381. * so is a good test of clockspeed rather than system throughput.
  382.  
  383.     cnop    0,4
  384.  
  385. lotsadivs2
  386.     move.l    d2,d0            * Total loop time is 5* 62 cycles
  387.     move.l    d3,d1
  388.     divs    d0,d1
  389.  
  390.     move.l    d2,d0
  391.     move.l    d3,d1
  392.     divs    d0,d1
  393.  
  394.     move.l    d2,d0
  395.     move.l    d3,d1
  396.     divs    d0,d1
  397.  
  398.     move.l    d2,d0
  399.     move.l    d3,d1
  400.     divs    d0,d1
  401.  
  402.     move.l    d2,d0
  403.     move.l    d3,d1
  404.     divs    d0,d1
  405.  
  406.     dbra    d7,lotsadivs2
  407.     rts
  408.  
  409.  
  410. *
  411. * SlightlyMoistSmallRocks:-
  412. * The Performance test benchmark consists of some commonly used math, logic
  413. * and general instructions in a mishmash that hopefully represents a reasonable
  414. * average program in genre mix.
  415. *
  416. * ie: 1 mul, 1 div, 2 shifts, 5 logic, and 5 general instructions in a mix.
  417. * Also note the General instructions are opened out to ensure that a
  418. * 256 byte cache will miss 50% thus having to fetch from RAM.  On a 68040
  419. * the cache will catch it all unless we open it out to 8k
  420. *
  421. * This benchmark tests general system performance rather than mere clockspeed!
  422. *
  423.  
  424. SlightlyMoistSmallRocks
  425.     move.w    #10000,d7        * Number of times to do this benchmark loop
  426.  
  427. benchmark
  428.     bsr    domuls
  429.     bsr    dodivs
  430.     bsr    doshifts
  431.     bsr    doshifts
  432.     bsr    dologic
  433.     bsr    dologic
  434.     bsr    dologic
  435.     bsr    dologic
  436.     bsr    dologic
  437.     bsr    dogeneral
  438.     bsr    dogeneral
  439.     bsr    dogeneral
  440.     bsr    dogeneral
  441.     bsr    dogeneral
  442.  
  443.     dbra    d7,benchmark
  444.     rts
  445.  
  446.     cnop    0,4
  447.  
  448. * Benchmark frags...
  449.  
  450. domuls    move.l    #32767,d0
  451.     move.l    #32767,d1
  452.     muls    d0,d1
  453.     move.l    #32767,d0
  454.     moveq    #-1,d1
  455.     mulu    d0,d1
  456.     rts
  457.  
  458.     cnop    0,4
  459.  
  460. dodivs    move.l    #65535,d0
  461.     move.l    #32767,d1
  462.     divs    d1,d0
  463.     move.l    #65535,d0
  464.     move.l    #32767,d1
  465.     divu    d1,d0
  466.     rts
  467.  
  468.     cnop    0,4
  469.  
  470. doshifts
  471.     asl.l    #8,d0
  472.     asr.l    #8,d0
  473.     rol.l    #8,d0
  474.     ror.l    #8,d0
  475.     rts
  476.  
  477.     cnop    0,4
  478.  
  479. dogeneral
  480.     add.l    d0,d0
  481.     add.l    d0,d0
  482.     add.l    d0,d0
  483.     add.l    d0,d0
  484.     add.l    #12345,d0
  485.     sub.l    #12345,d0
  486.     lea    tentable(pc),a0
  487.     move.l    4(a0),d0
  488.     move.l    8(a0),d0
  489.     move.l    12(a0),d0
  490.     bsr    dogen2
  491.     ext.w    d0
  492.     ext.l    d0
  493.     move.l    #12345,d0
  494.     swap    d0
  495.     exg    d0,d1
  496.     clr.l    d1
  497.     neg.l    d0
  498.     add.l    d0,d0
  499.     add.l    d0,d0
  500.     add.l    d0,d0
  501.     add.l    d0,d0
  502.     add.l    #12345,d0
  503.     sub.l    #12345,d0
  504.     lea    tentable(pc),a0
  505.     move.l    4(a0),d0
  506.     move.l    8(a0),d0
  507.     move.l    12(a0),d0
  508.     bsr    dogen2
  509.     ext.w    d0
  510.     ext.l    d0
  511.     move.l    #12345,d0
  512.     swap    d0
  513.     exg    d0,d1
  514.     clr.l    d1
  515.     neg.l    d0
  516.     add.l    d0,d0
  517.     add.l    d0,d0
  518.     add.l    d0,d0
  519.     add.l    d0,d0
  520.     add.l    #12345,d0
  521.     sub.l    #12345,d0
  522.     lea    tentable(pc),a0
  523.     move.l    4(a0),d0
  524.     move.l    8(a0),d0
  525.     move.l    12(a0),d0
  526.     bsr    dogen2
  527.     ext.w    d0
  528.     ext.l    d0
  529.     move.l    #12345,d0
  530.     swap    d0
  531.     exg    d0,d1
  532.     clr.l    d1
  533.     neg.l    d0
  534.     add.l    d0,d0
  535.     add.l    d0,d0
  536.     add.l    d0,d0
  537.     add.l    d0,d0
  538.     add.l    #12345,d0
  539.     sub.l    #12345,d0
  540.     lea    tentable(pc),a0
  541.     move.l    4(a0),d0
  542.     move.l    8(a0),d0
  543.     move.l    12(a0),d0
  544.     bsr    dogen2
  545.     ext.w    d0
  546.     ext.l    d0
  547.     move.l    #12345,d0
  548.     swap    d0
  549.     exg    d0,d1
  550.     clr.l    d1
  551.     neg.l    d0
  552.     add.l    d0,d0
  553.     add.l    d0,d0
  554.     add.l    d0,d0
  555.     add.l    d0,d0
  556.     add.l    #12345,d0
  557.     sub.l    #12345,d0
  558.     lea    tentable(pc),a0
  559.     move.l    4(a0),d0
  560.     move.l    8(a0),d0
  561.     move.l    12(a0),d0
  562.     bsr    dogen2
  563.     ext.w    d0
  564.     ext.l    d0
  565.     move.l    #12345,d0
  566.     swap    d0
  567.     exg    d0,d1
  568.     clr.l    d1
  569.     neg.l    d0
  570.     add.l    d0,d0
  571.     add.l    d0,d0
  572.     add.l    d0,d0
  573.     add.l    d0,d0
  574.     add.l    #12345,d0
  575.     sub.l    #12345,d0
  576.     lea    tentable(pc),a0
  577.     move.l    4(a0),d0
  578.     move.l    8(a0),d0
  579.     move.l    12(a0),d0
  580.     bsr    dogen2
  581.     ext.w    d0
  582.     ext.l    d0
  583.     move.l    #12345,d0
  584.     swap    d0
  585.     exg    d0,d1
  586.     clr.l    d1
  587.     neg.l    d0
  588.     add.l    d0,d0
  589.     add.l    d0,d0
  590.     add.l    d0,d0
  591.     add.l    d0,d0
  592.     add.l    #12345,d0
  593.     sub.l    #12345,d0
  594.     lea    tentable(pc),a0
  595.     move.l    4(a0),d0
  596.     move.l    8(a0),d0
  597.     move.l    12(a0),d0
  598.     bsr    dogen2
  599.     ext.w    d0
  600.     ext.l    d0
  601.     move.l    #12345,d0
  602.     swap    d0
  603.     exg    d0,d1
  604.     clr.l    d1
  605.     neg.l    d0
  606.     add.l    d0,d0
  607.     add.l    d0,d0
  608.     add.l    d0,d0
  609.     add.l    d0,d0
  610.     add.l    #12345,d0
  611.     sub.l    #12345,d0
  612.     lea    tentable(pc),a0
  613.     move.l    4(a0),d0
  614.     move.l    8(a0),d0
  615.     move.l    12(a0),d0
  616.     bsr    dogen2
  617.     ext.w    d0
  618.     ext.l    d0
  619.     move.l    #12345,d0
  620.     swap    d0
  621.     exg    d0,d1
  622.     clr.l    d1
  623.     neg.l    d0
  624.     bra    dogen1
  625.     nop
  626. dogen1    move.w    #123,d1
  627. dogen2    rts
  628.  
  629.     cnop    0,4
  630.  
  631. dologic    and.l    #65535,d0
  632.     or.l    #65535,d0
  633.     eor.l    #65535,d0
  634.     and.l    d1,d0
  635.     not.l    d0
  636.     rts
  637.  
  638.  
  639. gettimer
  640.     lea    datevals(pc),a0
  641.  
  642.     move.l    a0,d1
  643.     move.l    _DosBase,a6        * Get DOS's 1/50th sec timestamp
  644.     jsr    _LVODateStamp(a6)    *
  645.  
  646.     lea    datevals(pc),a0
  647.  
  648.     move.l    4(a0),d0        * Minutes
  649.     and.l    #$ffff,d0
  650.     mulu    #60*50,d0        * Find it in fiftieths of Seconds!
  651.  
  652.     move.l    8(a0),d1        * Ticks, 50 per second!
  653.     and.l    #$ffff,d1
  654.  
  655.     add.l    d1,d0
  656.  
  657.     rts
  658.  
  659.  
  660.  
  661.  
  662. *
  663. * fastish print string..like JSR p on the old beebon
  664. * all registers unaffected.
  665. *
  666. * Enter with text immediately following the BSR P subroutine call.
  667. * This then prints the text out, and returns to the PC immediate after
  668. * where P was called from.  Note: Some debuggers have trouble single stepping
  669. * this code.  Their fault, not ours!
  670. *
  671.  
  672. p    move.l    a3,-(a7)
  673.     move.l    4(a7),a3        * posn. of text to be printed
  674.     movem.l    d1-d3/a0/a1,-(a7)    * save d1,d2,d3,a0,a1
  675.     move.l    a3,d2
  676. p1    tst.b    (a3)+            * } find length of text
  677.     bne.s    p1            * }
  678.  
  679.     move.l    a3,d3
  680.     subq.l    #1,d3            * dont include NULL
  681.     sub.l    d2,d3            * now., d3=length of text
  682.     move.l    chandle,d1        * now, d1=handle, d2=posn of text, d3=length
  683.     move.l    _DosBase,a6
  684.     jsr    _LVOWrite(a6)
  685.     movem.l    (a7)+,d1-d3/a0/a1     * restore regs..
  686.     move.w    a3,d1
  687.     and.b    #1,d1            * see if its a non-word aligned
  688.     beq.s    p3
  689.     addq.l    #1,a3
  690. p3    move.l    a3,4(a7)        * stick next instuction posn back on stack
  691.     move.l    (a7)+,a3
  692.  
  693.     rts                * finish!
  694.  
  695.  
  696. *
  697. * Prints out the time in a nn.nn quantity
  698. *
  699. * Uses fixed point 'Rithmetic.
  700. *
  701.  
  702. printfrac
  703.  
  704.     tst.w    d6
  705.     beq.s    nodiv3
  706.     divu    d6,d0
  707.  
  708.     move.l    d0,d4            * Save off remainder into d4
  709.     clr.w    d4
  710.     swap    d4
  711.  
  712.     lea    printbuffer(pc),a4
  713.     move.w    d0,integer
  714.  
  715.     bsr    bin2decw
  716.     move.b    #".",(a4)+        * Decimal point
  717.  
  718.     mulu    #100,d4            * Calculate n/100th Fractional part
  719.     tst.w    d6
  720.     beq.s    nodiv3
  721.     divu    d6,d4
  722.  
  723.     cmp.w    #100,d4            * Error check... Greater than 100/100 ?
  724.     bge.s    nodiv3            * Sounds fishy to me!
  725.  
  726.     cmp.w    #10,d4            * Single lone decimal digit
  727.     bge.s    nolead0
  728.  
  729.     move.b    #"0",(a4)+        * ...needs leading 0
  730.  
  731. nolead0    move.l    d4,d0            * Display it
  732.     bsr    bin2decw
  733.     bra.s    nodiv4
  734.  
  735. nodiv3    move.b    #"0",(a4)+        * Force .0 if integer is whole
  736.  
  737. nodiv4    lea    printbuffer(pc),a5    * Okeydoke, now prindit
  738.     move.l    a5,d2            * d2 = Address
  739.     sub.l    a5,a4
  740.     move.l    a4,d3            * d3 = length
  741.     move.l    chandle,d1        * now, d1=handle, d2=posn of text, d3=length
  742.     move.l    _DosBase,a6
  743.     jmp    _LVOWrite(a6)
  744.  
  745.  
  746. printbin2dec
  747.     move.l    d0,-(sp)
  748.  
  749.     lea    printbuffer(pc),a4
  750.     bsr    bin2decw
  751.  
  752.     lea    printbuffer(pc),a5
  753.     move.l    a5,d2            * d2 = Address
  754.     sub.l    a5,a4
  755.     move.l    a4,d3            * d3 = length
  756.     move.l    chandle,d1        * now, d1=handle, d2=posn of text, d3=length
  757.     move.l    _DosBase,a6
  758.     jsr    _LVOWrite(a6)
  759.  
  760.     move.l    (sp)+,d0
  761.     rts
  762.  
  763.  
  764.     cnop    0,4
  765.  
  766. * Power of Ten table! (for binary/ascii routines!)
  767.  
  768. tentable
  769.     dc.l     1            * P
  770.     dc.l     10            *  r
  771.     dc.l     100            *   e
  772.     dc.l     1000            *    t
  773.     dc.l     10000            *     t
  774. tenbckw    dc.l     100000            *      y
  775.     dc.l     1000000        *       
  776.     dc.l     10000000        *       h
  777.     dc.l     100000000        *        u
  778. tenback    dc.l     1000000000        *         h
  779.                     *          ?
  780.  
  781. * Print a number that is contained in binary in d0
  782. bin2decw    movem.l    d0-d7/a0,-(sp)
  783.     and.l    #$ffff,d0
  784.     clr.w    d4
  785.     lea    tenbckw(pc),a0
  786.     moveq    #4,d3
  787.     tst.w    d0
  788.     beq.s    binzero
  789.     bpl.s    bindecl
  790.     neg.w    d0
  791.     bra.s    bindecw
  792.  
  793. * Print up a Long Word in binary
  794. bin2decl    movem.l    d0-d7/a0,-(sp)
  795.     clr.w    d4
  796.     lea    tenback(pc),a0
  797.     moveq    #8,d3
  798.     tst.l    d0
  799.     beq.s    binzero
  800.     bpl.s    bindecl
  801.     neg.l    d0
  802.  
  803. bindecw    move.b    #'-',(a4)+
  804.  
  805. bindecl    move.l    -(a0),d1
  806.     clr.w    d2
  807.  
  808. bindec1    sub.l    d1,d0
  809.     bmi.s    bindec2
  810.     addq.w    #1,d2
  811.     bra.s    bindec1
  812.  
  813. bindec2    add.l    d1,d0
  814.  
  815.     tst.w    d2
  816.     bne.s    bindecz
  817.     tst.w    d4
  818.     beq.s    bindec3
  819.  
  820. bindecz    move.w    d2,d1
  821.     add.w    #$30,d1
  822.     move.b    d1,(a4)+
  823.     moveq    #1,d4
  824.  
  825. bindec3    dbra    d3,bindecl
  826.     movem.l    (sp)+,d0-d7/a0
  827.     rts
  828.  
  829. * Special Case of Zero
  830.  
  831. binzero    move.b    #'0',(a4)+
  832.     clr.b    (a4)+
  833.     movem.l    (sp)+,d0-d7/a0
  834.     rts
  835.  
  836.  
  837.  
  838.  
  839. thedos    dc.b    "dos.library",0
  840.  
  841. integer        ds.w    1
  842.  
  843.     cnop    0,4
  844.  
  845. _DosBase    ds.l    1
  846. chandle        ds.l    1
  847. ohandle        ds.l    1
  848. procrate    ds.l    1
  849.  
  850.  
  851. datevals    ds.l    4
  852.  
  853. printbuffer    ds.l    10
  854.  
  855.  
  856.     end
  857.  
  858.